<template>
	<view class="leaveIndex">
		<view class="itemLine" v-for="item in list" :key="item.id" @click="toDetial(item)">
			<view class="icon">
				<u-icon name="account-fill" color="#2979ff" size="22"></u-icon>
			</view>
			<view class="info">
				<view class="titles">发文号申请</view>
				<view class="yy">
					<text class="tip">发文类型:</text>
					<dictTag type="oa_document_type" :value="item.type"></dictTag>
				</view>
				<view class="yy">
					<text class="tip">申请人:</text>
					<text>{{item.applicant}}</text>
				</view>
				<view class="yy">
					时间:{{$u.timeFormat(item.createTime, 'yyyy-mm-dd')}}
				</view>
			</view>
			<view class="status">
				<dictTag statusBtn="primary" type="bpm_process_instance_status" :value="item.status"></dictTag>
			</view>
		</view>
	</view>
</template>

<script>
	// import {getLeavePage} from '@/api/oa/leave/index.js'
	import {getOaApplicationNumberPage} from '@/api/oa/applicationNumber/index.js'
	import {formatDate} from '@/utils/formatTime.js'
	import dictTag from '@/components/common/dictTag.vue'
	import {setToken,getAccessToken,getRefreshToken,getTenantId } from '@/utils/auth'
	export default {
		components:{
			dictTag
		},
		data() {
			return {
				queryParams:{
					pageNo: 1,
					pageSize: 10,
				},
				list:[],
				isLast:false,
			};
		},
		methods:{
			// 获取列表
			async getlist(){
				let listInfo = await getOaApplicationNumberPage(this.queryParams);
				let list = listInfo.data;
				if(list.list.length <= 0){
					this.isLast = true;
					return false
				}
				this.list = [...this.list,...list.list];
			},
			// 点击跳转详情
			toDetial(data){
				console.log(data)
				uni.navigateTo({
					url:'/pages/process/applicationNumber/detial?id='+data.processInstanceId
				})
			},
		},
		onLoad() {
			this.queryParams.pageNo = 1;
			this.list = [];
			this.getlist();
		},
		onReachBottom(){
			console.log('触底了！')
			// 判断是否是最后一页
			if(!this.isLast){
				this.queryParams.pageNo = this.queryParams.pageNo + 1;
				this.getlist()
			}
		},
		onPullDownRefresh(){
			this.queryParams.pageNo = 1;
			this.isLast = false;
			this.list = [];
			this.getlist();
			uni.stopPullDownRefresh();//停止刷新
		}
	}
</script>

<style lang="less" scoped>
.leaveIndex{
	width: 100%;
	height: auto;
	.itemLine{
		width: 100%;
		height: auto;
		border-bottom: 1rpx solid #ddd;
		box-sizing: border-box;
		background-color: rgba(255, 255, 255,0.6);
		display: flex;
		align-items: flex-start;
		padding: 20rpx 30rpx;
		box-sizing: border-box;
		.icon{
			flex: none;
		}
		.info{
			flex: 1;
			margin-left: 20rpx;
			.titles{
				font-size: 30rpx;
				color: #333;
				font-weight: bold;
			}
			.yy{
				font-size: 26rpx;
				color: #333;
				margin-top: 10rpx;
				display: flex;
				align-items: center;
				.tip{
					margin-right: 20rpx;
				}
			}
		}
		.status{
			flex: none;
		}
	}
}
</style>
